﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;


namespace BLL.Sec
{
    /// <summary>
    /// 
    /// </summary>
    public class UserNode
    {
        private readonly OracleDAL.Sec.UserNode dal = new OracleDAL.Sec.UserNode();
        public UserNode()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string USERISN)
        {
            return dal.Exists(USERISN);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Sec.UserNode model)
        {
           return  dal.Add(model);
        }
         /// <summary>
        /// 给单位下所有用户增加资源范围权限
        /// </summary>
        /// <param name="NodeID">节点ID</param>
        /// <param name="NodeISN">节点ISN</param>
        /// <param name="UnitISN">单位ISN</param>
        /// <returns></returns>
        public bool Add(string NodeID, string NodeISN, string UnitISN)
        {
            return dal.Add(NodeID, NodeISN, UnitISN);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Sec.UserNode model)
        {
           return dal.Update(model);
        }
        /// <summary>
        /// 更新单位下所有用户资源范围权限
        /// </summary>
        /// <param name="NodeID">节点ID</param>
        /// <param name="NodeISN">节点ISN</param>
        /// <param name="UnitISN">单位ISN</param>
        /// <returns></returns>
        public bool Update(string NodeID, string NodeISN, string UnitISN)
        {
            return dal.Update(NodeID, NodeISN, UnitISN);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(string USERISN)
        {

            dal.Delete(USERISN);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Sec.UserNode GetModel(string USERISN)
        {

            return dal.GetModel(USERISN);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Sec.UserNode> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List<Model.Sec.UserNode> modelList = new List<Model.Sec.UserNode>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
                Model.Sec.UserNode model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Sec.UserNode();
                    model.USERISN = ds.Tables[0].Rows[n]["USERISN"].ToString();
                    model.NODEID = ds.Tables[0].Rows[n]["NODEID"].ToString();
                    model.NODEISN = ds.Tables[0].Rows[n]["NODEISN"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}
